﻿using AutoMapper;
using Basic.Traceability.Domain.Freed;
using Basic.Traceability.Domain.Products;
using Basic.Traceability.Domain.Slaughter;
using Basic.Traceability.Host.Api.Write.Application.Command.Freed.Breed56EnterpriseInformation;
using Basic.Traceability.Host.Api.Write.Application.Command.Freed.BreedingInformation;
using Basic.Traceability.Host.Api.Write.Application.Command.Freed.HealthInformation;
using Basic.Traceability.Host.Api.Write.Application.Command.Products.TraceableProducts;
using Basic.Traceability.Host.Api.Write.Application.Command.Slaughter.SlaughterEnterprise;

namespace Basic.Traceability.Host.Api.Write
{
    public class MyAutoMapper : Profile
    {
        public MyAutoMapper()
        {
            CreateMap<CreateTraceableProductsCommand, TraceableProductsModel>();
            CreateMap<CreateBreed56EnterpriseInformationCommand, Breed56EnterpriseInformationModel>();
            CreateMap<CreateBreedingInformationCommand, BreedingInformationModel>();
            CreateMap<CreateSlaughterEnterpriseCommand, SlaughterEnterpriseModel>();
            CreateMap<CreateHealthInformationCommand, HealthInformationModel>();
            CreateMap<UpdateTraceableProductsCommand, TraceableProductsModel>()
                .ForAllMembers(opts => opts.Condition((src, dest, srcMember) => srcMember != null));
        }
    }
}
